use crate::cli::VersionSubCommands::Plugin;
use crate::context::restore_terminal;
use crate::model::enum_type::{ArchType, OsType, PackType, SumType};
use crate::model::version::VersionItem;
use crate::plugin;
use shadow_rs::new_hook;

pub mod version_search;

pub(crate) fn search() -> color_eyre::Result<()> {
    let mut version_list: Vec<VersionItem> = vec![];
    version_list.push(VersionItem::new(
        "java",
        "17",
        ArchType::X86,
        OsType::Windows,
        "",
        "",
        "",
        100,
        PackType::Zip,
        true,
        vec![],
        "",
        SumType::Sha1,
        None,
        false,
        Some("tencent"),
    ));
    for _i in 1..10 {
        version_list.push(VersionItem::new(
            "java",
            "1.8",
            ArchType::X86,
            OsType::Windows,
            "",
            "",
            "",
            120,
            PackType::Zip,
            true,
            vec![],
            "",
            SumType::Sha1,
            None,
            true,
            Some("alibaba"),
        ));
    }

    version_search::SearchApp::new(version_list).run()?;
    restore_terminal()?;
    Ok(())
}
